The present invention relates to coherent hardware accelerators, and more specifically to sharing a single context on a coherent hardware accelerator among multiple processes.
In some computer systems, accelerators may be installed to accelerate various specialized operations, such as graphics processing, encryption and decryption, compression and decompression, massively parallel processing (e.g., big data processing, fluid dynamic simulations, and so on), and other computationally expensive tasks. Traditional hardware accelerator systems may be designed as an add-on board that interfaces with a processor via a physical bus (e.g., PCI Express). As processes run on these accelerator systems, the accelerator interfaces with system memory using direct memory access in which the accelerator directly accesses regions of memory using real, rather than virtual, addresses. By accessing memory using direct memory access, an accelerator can bypass the memory management systems built into CPUs installed in a system.
Some hardware accelerators may be designed to interface with system memory using a virtual memory space established by a CPU. A process can attach to the accelerator and create a context, which includes information about the virtual memory space allocated to the process, as well as other information. While the process executes on the accelerator, the accelerator can read from and write to system memory using virtual addresses associated with the virtual memory space in lieu of direct memory access using physical memory addresses.
Accelerators may support a fixed number of hardware contexts. For example, for applications with a parent process and no or few child processes that also use the accelerator, the parent process and each of the child processes can attach to separate accelerator hardware contexts while leaving a pool of unused accelerator hardware contexts available for use by other processes. Some large applications may spawn a large number of separate child processes, which may exceed the number of hardware contexts available at the accelerator.